#include <Arduino.h>
#include "BlinkLED.h"

static unsigned long previousMillis = 0;
static int blinkCount = 0;
static bool ledState = false;

void setupBlinkLED() {
    pinMode(LED_PIN, OUTPUT);
    digitalWrite(LED_PIN, HIGH);
}

void updateBlinkLED() {
    unsigned long currentMillis = millis();

    if (currentMillis - previousMillis >= (blinkCount < 4 ? BLINK_INTERVAL : PAUSE_INTERVAL)) {
        previousMillis = currentMillis;

        if (blinkCount < 4) {
            ledState = !ledState;
            digitalWrite(LED_PIN, ledState ? LOW : HIGH);
            blinkCount++;
        } else {
            blinkCount = 0;
            ledState = false;
            digitalWrite(LED_PIN, HIGH);
        }
    }
}